package com.winter.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.winter.entity.CooperatorConf;
import com.winter.entity.CooperatorConfExample;
import com.winter.repository.CooperatorConfMapper;
import com.winter.service.CooperatorConfService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.Collections;
import java.util.List;

/**
 * @author Jinhao
 * Date: 2023/01/17 18:52
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class CooperatorConfServiceImpl implements CooperatorConfService {

    private final CooperatorConfMapper cooperatorConfMapper;

    @Override
    public List<CooperatorConf> findAll() {
        List<CooperatorConf> cooperatorConfList = cooperatorConfMapper.selectList(null);
        if (CollectionUtils.isEmpty(cooperatorConfList)) {
            return Collections.emptyList();
        }
        return cooperatorConfList.subList(0, 20);
    }
}
